package com.fosun.sprcore.tools.generatecode.template;

import java.util.HashMap;
import java.util.Map;

import com.fosun.sprcore.tools.generatecode.base.BaseTemplate;
import com.fosun.sprcore.tools.generatecode.base.GenerateCodeMain;

/**
 * 生成Service方法
 * @author Chensm
 *
 */
public class ServiceMethodTemplate extends BaseTemplate{
	private final static String TEMPLATE_PATH = "sprcore/ServiceMethodTemplate/";

	private String methodName;
	private String serviceName;
	private String packageName;
	private String methodType;
	private String submitMethod;
	
	@Override
	public void generate(GenerateCodeMain main) throws Exception {
		Map data = new HashMap<String,String>();
		data.put("projectWar", projectWar);
		data.put("methodName", methodName);
		data.put("serviceName", serviceName);
		data.put("packageName", packageName);
		data.put("methodType", methodType==null?"":methodType	);
		data.put("submitMethodU", submitMethod);
		
		String serviceNameU = serviceName.substring(0,1).toUpperCase()+serviceName.substring(1);
		data.put("serviceNameU", serviceNameU);

		String methodNameU = methodName.substring(0,1).toUpperCase()+methodName.substring(1);
		data.put("methodNameU", methodNameU);
		
		main.generate(TEMPLATE_PATH+"t_SpModel.java", methodNameU+"SpModel.java", data);
		main.generate(TEMPLATE_PATH+"t_SrModel.java", methodNameU+"SrModel.java", data);
		main.generate(TEMPLATE_PATH+"t_other.java", "other.java", data);
		
	}

	public String getMethodName() {
		return methodName;
	}

	public void setMethodName(String methodName) {
		this.methodName = methodName;
	}

	public String getServiceName() {
		return serviceName;
	}

	public void setServiceName(String serviceName) {
		this.serviceName = serviceName;
	}

	public String getPackageName() {
		return packageName;
	}

	public void setPackageName(String packageName) {
		this.packageName = packageName;
	}

	public String getMethodType() {
		return methodType;
	}

	public void setMethodType(String methodType) {
		this.methodType = methodType;
	}

	public String getSubmitMethod() {
		return submitMethod;
	}

	public void setSubmitMethod(String submitMethod) {
		this.submitMethod = submitMethod;
	}

	public static String getTemplatePath() {
		return TEMPLATE_PATH;
	}

 
 
	
	
	
}
